package cn.wen.yinxiu.works.dao;

import cn.wen.yinxiu.common.to.works.TopicTO;
import cn.wen.yinxiu.works.entity.TopicEntity;
import cn.wen.yinxiu.works.vo.TopicInfoVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName: TopicDao
 * @Author 小飞
 * @Email coderwen22@163.com
 * @Date 2023-05-22 09:39:56
 * @Description: 作品话题详情表的Dao层
 */
@Component
@Mapper
public interface TopicDao extends BaseMapper<TopicEntity> {

    /**
     * 获取作品的话题列表
     *
     * @param worksId
     * @return
     */
    List<TopicInfoVO> selectWorksTopicList(@Param("worksId") Long worksId);

    /**
     * 插入对应的数据
     *
     * @param topicIds
     * @param worksId
     */
    void saveTopicAndWorksIdRelation(@Param("topicIds") List<Long> topicIds,
                                     @Param("worksId") Long worksId);

    /**
     * 删除对应的话题
     *  @param worksId
     *
     */
    void deleteTopicAndWorksRelation(@Param("worksId") Long worksId);

    /**
     * 更新话题的浏览数
     *
     * @param topicList
     * @return
     */
    boolean updateTopicViewList(@Param("topicList") List<TopicTO> topicList);
}
